import Vue from "vue";
import VueRouter from "vue-router";
import routes from './routes'
Vue.use(VueRouter)
//防止路由频繁点击报错，重写 push | replace
let orginPush = VueRouter.prototype.push
let orginReplace = VueRouter.prototype.replace
VueRouter.prototype.push = function (location, res, rej) {
    if (rej && res) {
        orginPush.call(this, location, res, rej)
    } else {
        orginPush.call(this, location, () => { }, () => { })
    }
}
VueRouter.prototype.replace = function (location, res, rej) {
    if (rej && res) {
        orginReplace.call(this, location, res, rej)
    } else {
        orginReplace.call(this, location, () => { }, () => { })
    }
}
export default new VueRouter({
    routes,
})